
// 注册登录页面
document.querySelector(".button").onclick = function(){
    var omask = document.querySelector("#mask")
    var oClose = document.querySelector("#close")
    var oDialog = document.querySelector("#dialog")
    omask.style.display = 'block'
    oDialog.style.display = 'block'
    oClose.onclick = function(){
   oDialog.style.display = 'none'
   omask.style.display = 'none'

   oDialog.onmousedown =function(e){
       var x = e.clientX //兼容性
       var ev = e || event
       var x = ev.clientX - oDialog.offsetLeft
       var y = ev.clientY - oDialog.offsetTop
       document.onmousemove =function(e){
           var xx = e.clientX -x
           var yy = e.clientY - y

           if(xx <= 0){
               xx = 0
           }
           if(xx>=omask.clientWidth-oDialog.offsetWidth ){
           xx = omask.clientWidth - oDialog.offsetWidth
           }
           if(yy <= 0){
              yy = 0
           }
           if(yy>=omask.clientHeight-oDialog.offsetHeight){
            yy = omask.clientHeight- oDialog.offsetHeight
           }
           oDialog.style.left = xx + "px"
           oDialog.style.top = yy +"px"
       }
       document.onmouseup = function(){
           document.onmousemove =null
       }
   }

}
}

// 二级菜单
window.onload = function() {
    var li = [...document.querySelectorAll(".dialog-left ul li")]
    var div = [...document.querySelectorAll('.yanzheng>div')]
    li.forEach(function(item, index) {
        
        item.onclick = function() {
            div.forEach(function(item, index) {
                item.classList.remove("div")
            })
            div[index].classList.add("div")
        }

    })

}
   